#include <stdio.h>

#include "jy61p.h"
#include "usart/_usart.h"

extern usart_t uart1;

jy61p_t my_jy61p;

volatile uint8_t jy61p_buffer[11];

void jy61p_init()
{
    usart_send_data(uart1.uartx, (uint8_t*)"jy61p_init", 10);
}

void jy61p_usart_RxCallback()
{
    my_jy61p.roll  = (float)((jy61p_buffer[4] << 8) | jy61p_buffer[5]) / 32768 * 180;
    my_jy61p.pitch = (float)((jy61p_buffer[2] << 8) | jy61p_buffer[3]) / 32768 * 180;
    my_jy61p.yaw   = (float)((jy61p_buffer[0] << 8) | jy61p_buffer[1]) / 32768 * 180;
}
